<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<%@ taglib prefix="sales" tagdir="/WEB-INF/tags/sales"%>

<form class="mainForm" name="giftListForm" method="post" id="giftListForm" action="${ctxPath}/sales/gift.html">
	<c:set var="editURLPath"	value="/sales/gift.html?doAction=edit&from=list" scope="page" />
	<div class="top clearfix">
		<ul class="tab">
			<li class="curr"><span><fmt:message key="menu.giftList"/></span></li>
		</ul>
		<%@include file="/common/pagingOnlyTop.jsp"%>
	</div>
	<div class="data">		
		<c:set var="checkAll">
			<input type="checkbox" name="allbox" onclick="checkAll(this.form)"	class="checkbox" />
		</c:set>
		<c:set var="isNeedTopPaging" value="true"/>
		<table id="gift" width="100%" border="0" cellspacing="0" cellpadding="0" class="list_table">	
			<tr>
			  	<th width="20"><input onclick="checkAll(this.form)" name="allbox" type="checkbox" value="" /></th>	
				<th style="width:12%">
					<span><fmt:message key="gift.imageUrl" /></span>
				</th>
				<th class='sortable ${(giftSearchCriteria.orderby eq 3)?"sorted order1":((giftSearchCriteria.orderby eq 4)?"sorted order2":"")}'>
					<a onclick="sortField(this,3,4)"><fmt:message key="gift.giftName" /></a>
				</th>
				<th style="width:15%" class='sortable ${(giftSearchCriteria.orderby eq 13)?"sorted order1":((giftSearchCriteria.orderby eq 14)?"sorted order2":"")}'>
					<a onclick="sortField(this,13,14)"><fmt:message key="gift.giftCode" /></a>
				</th>
				<!--
				<th  style="width:10%">
					<span><fmt:message key="gift.point" /></span>
				</th>
				-->
				<th  style="width:10%" class='sortable ${(giftSearchCriteria.orderby eq 15)?"sorted order1":((giftSearchCriteria.orderby eq 16)?"sorted order2":"")}'>
					<a onclick="sortField(this,15,16)"><fmt:message key="gift.quantityOnHand" /></a>
				</th>
				<!-- 
				<th  style="width:10%">
					<span><fmt:message key="gift.allocatedQuantity" /></span>
				</th>
				 -->
				<th  style="width:15%" class='sortable ${(giftSearchCriteria.orderby eq 17)?"sorted order1":((giftSearchCriteria.orderby eq 18)?"sorted order2":"")}'>
					<a onclick="sortField(this,17,18)"><fmt:message key="gift.category" /></a>
				</th>
				<th  style="width:8%" class='sortable ${(giftSearchCriteria.orderby eq 12)?"sorted order1":((giftSearchCriteria.orderby eq 11)?"sorted order2":"")}'>
					<a onclick="sortField(this,12,11)"><fmt:message key="gift.status" /></a>
				</th>
			</tr>
			<c:forEach var="gift" items="${giftList}" varStatus="status">
				<tr id="tr${gift.giftId}" giftId="${gift.giftId}" class="${(status.index%2==0)?'even':'odd'}">
					<td>
						<c:if test="${giftSearchCriteria.status != 3}">
							<common:htmlEscape value="${gift.giftName}" returnValue="giftName"/>
							<input type="checkbox" name="multiIds" value="${gift.giftId}" class="checkbox" title="${giftName}" tags="${tagNames}"/>
						</c:if>
					</td>
					<td>
						<a href="javascript:void(0)" onclick="parent.editGift(${gift.giftId})">
							<sales:giftImage gift="${gift}" sizeType="s0" linkType="0" style="vertical-align:middle;" width="58" height="58"/>
						</a>
					</td>
					<td>
						<b><a href="javascript:void(0)"	onclick="parent.editGift(${gift.giftId})">${gift.giftName} </a></b>
					</td>
					<td>${gift.giftCode}</td>
					<!--<td>${gift.point}</td>	-->
					<td>
						<c:choose>
							<c:when test="${not empty gift.quantityOnHand}">
								<fmt:message key="gift.quantityOnHand" />:${gift.quantityOnHand}
								<br />
								<fmt:message key="gift.availableQuantity" />:${gift.availableQuantity}
								<br />
								<fmt:message key="inventory.allocatedQuantity" />:${gift.allocatedQuantity}
							</c:when>
							<c:otherwise>
								<fmt:message key="gift.quantityOnHand" />:
								<fmt:message key="inventory.availableQuantity.infinity" />
								<br />
								<fmt:message key="inventory.allocatedQuantity" />:${gift.allocatedQuantity}
							</c:otherwise>
						</c:choose>
					</td>
					<!-- <td>${gift.allocatedQuantity}</td> -->
					<td>${gift.category.categoryName}</td>
					<td>
						<fmt:message key="gift.status.${gift.status}"/>
					</td>
				</tr>
				<tr style="display: none;" class="${(status.index%2==0)?'even':'odd'} sub" >
				</tr>	
			</c:forEach>
			<c:if test="${empty giftList}">
				<tr>
					<td colspan="9" style="text-align:center">
						<fmt:message key="giftList.empty"/>
					</td>
				</tr>
			</c:if>
		</table>	
		<%@include file="/common/pagingOnly.jsp" %>
	</div>
</form>
<%--------保存查询条件 -------%>
<%@include file="giftSearchCriteriaStorage.jspf"%>

<script type="text/javascript">
$j(document).ready(function () {
	highlightTableRows("gift");
});
</script>
